<!doctype html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<title>发送邮件</title>
	<script type="text/javascript" src="/js/jquery-2.0.3.min.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">

 	<!--[if lt IE 9]>
     <script src="/js/jquery-1.11.1.js"></script>
     <script src="/js/html5shiv.js"></script>
     <script src="/js/respond.min.js"></script>
     <![endif]-->
     <script type="text/javascript" src="/js/bootstrap.min.js"></script>
     <style type="text/css">
     input[type=text],textarea{
     	width: 98%;qqq
     }
     textarea{
     	height: 200px;
     	resize:none;
     	overflow: auto;
     }
     </style>
 </head>
 <body>
 <div>邮件发送</div>
 	<form name="mailerForm">
 		<table class="table table-bordered" style="width:100%;">
 			<tr>
 				<td colspan="2">说明：发送者是163邮箱时是可以发送成功的，其他的未测试。</td>
 			</tr>
 			<tr>
 				<th style="width:20%;">名称</th>
 				<th>内容</th>
 			</tr>
 			<tr>
 				<td>接收者邮箱</td>
 				<td><input type="text" name="receiver" style="width:50%;" value="">
 					<select name="receiveHoster" style="height:26px;margin-left: -5px;">
 						<option value="163.com">@163.com</option>
 						<option value="qq.com" >@qq.com</option>
 						<option value="139.com">@139.com</option>
 						<option value="Yahoo.com">@Yahoo.com</option>
 						<option value="126.com">@126.com</option>

 					</select>
 				</td>
 			</tr>
 			<tr>
 				<td>发送者邮箱</td>
 				<td><input type="text" name="sender" style="width:50%;" value="">
 					<select name="senderHoster" style="height:26px;margin-left: -5px;">
 						<option value="163">@163.com</option>

 						<option value="139">@139.com</option>
 						<option value="Yahoo">@Yahoo.com</option>
 						<option value="126">@126.com</option>

 					</select>
 				</td>
 			</tr>
 			<tr>
 				<td>发送者邮箱密码</td>
 				<td><input type="password" name="senderPWD" value=""></td>
 			</tr>
 			<tr>
 				<td>标题</td>
 				<td><input type="text" name="header" value=""></td>
 			</tr>
 			<tr >
 				<td colspan="2">内容:
 					<textarea name="content"></textarea></td>
 				</tr>
 				<tr>
 					<td colspan="2" style="text-align:center"><input type="button" class="btn btn-default send" value="发送"></td>
 				</tr>
 			</table>
 		</form>
 		<script type="text/javascript">

	// parent.document.all("mainIframe").style.width=document.body.scrollWidth;

		$("input.send").on("click",function(){

			var query = {
				content: $("textarea[name='content']").val(),
				header: $("input[name=header]").val(),
				receiveHoster: $("select[name=receiveHoster]").val(),
				receiver: $("input[name=receiver]").val(),
				sender: $("input[name=sender]").val(),
				senderHoster: $("select[name=senderHoster]").val(),
				senderPWD: $("input[name=senderPWD]").val()
			}
			if(!query.receiver){
				alert("接收者不能为空");
				$("input[name='receiver']").focus().select();
				return false;
			}
			if(!query.sender){
				alert("发送者不能为空");
				$("input[name='sender']").focus();
				return false;
			}
			if(!query.senderPWD){
				alert("发送者密码不能为空");
				$("input[name='senderPWD']").focus();
				return false;
			}
			if(!query.content && !query.header){
				alert("标题和内容不能同时为空");
				$("input[name='header']").focus();
				return false;
			}
		
			$.post("/mailer/send", query, function(back){
				
					alert("email is sended "+back);
				
			});
		});
	</script>

 <%- include iframeSet%>
</body>
</html>